/** ###################################################################
**     Filename  : Read.C
**     Project   : Read
**     Processor : 56F8013VFAE
**     Version   : Driver 01.14
**     Compiler  : Metrowerks DSP C Compiler
**     Date/Time : 2012-3-24, 21:28
**     Abstract  :
**         Main module.
**         This module contains user's application code.
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/
/* MODULE Read */


/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "AS1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Serial.h"

//uint8_t *read;
//uint8_t *temp;
unsigned int flag,i,temp;
unsigned char p[15];
unsigned int read,san;
unsigned int L;
double sum;

void main(void)
{
  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
 // AS1_Enable();
   L=10;
   
  for(;;) {
  
 //    Term1_ReadChar(read);
//     Term1_SendChar(*read);
 //      AS1_GetCharsInTxBuf();
//       AS1_RecvChar(&temp);
//       AS1_SendChar(temp);


//       AS1_RecvBlock(p,10,&read);

//       AS1_SendBlock(p,read,&san);
       
//       sum=2;
 /*      for(i=0;i<read;i++)
       {
       	if(p[i]=='.')
       	{
       	    temp=i;
       		flag=1;
       		break;
       	}
       }
       for(i=0;i<read;i++)
       {
         if(i<temp)
         {
         	p[i]=p[i]-0x30;
         	p[i]=Pow(p[i],(temp-1-i));
         	sum=sum+p[i];  
         }
         if(i>temp)
         {
         	p[i]=p[i]-0x30;
         	p[i]=Pow(p[i],(temp-i));
         	sum=sum+p[i];
         }
         
      //   AS1_SendChar('k');
              	
       } */
       
//       SendNum((int)sum);
       i=0;
       sum=(p[0]-0x30)*10;
       sum=sum+p[1]-0x30;
       sum=sum+(p[3]-0x30)*0.1;
       sum=sum+(p[4]-0x30)*0.01;
       sum=sum+(p[5]-0x30)*0.001;
               
       if(sum==12.003)
         SendNum(55);


       AS1_SendChar('a');
       AS1_SendChar('1');
       AS1_SendChar('2');
       AS1_SendChar('3');
       AS1_SendChar('4');
       AS1_SendChar('5');
       AS1_SendChar('6');
       AS1_SendChar('7');
       AS1_SendChar('8');
       AS1_SendChar('9');
       AS1_SendChar(0x0d);
       AS1_SendChar(0x0a);

   //    if(sum==12.003)
   //      AS1_SendChar('a');
       
       Cpu_Delay100US(1000);

  }
}

/* END Read */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.00 [04.35]
**     for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
